import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
//引入element-plus
import plus from "element-plus";
import "element-plus/dist/index.css";
//引入axios
import axios from "axios";
axios.defaults.baseURL = import.meta.env.VITE_APP_URL;
//引入 pinia
import { createPinia } from "pinia";
let pinia = createPinia();
////引入quillEditor
import { QuillEditor } from "@vueup/vue-quill";
import "@vueup/vue-quill/dist/vue-quill.snow.css";
//引入router
import router from "./router/router";
//引入NProgress
import NProgress from "nprogress";
import "nprogress/nprogress.css";

//axios拦截器
axios.interceptors.request.use(function (config) {
  // 在发送请求之前做些什么
  NProgress.start();
  config.headers.Authorization = window.sessionStorage.getItem("taken");
  return config;
});
axios.interceptors.response.use(function (response) {
  // 对响应数据做点什么
  NProgress.done();
  return response;
});
const app = createApp(App);
app.use(plus);
app.use(pinia);
app.use(router);
app.component("QuillEditor", QuillEditor);
app.mount("#app");
